package com.api.model;

public abstract class AbstractOauthApi extends AbstractApi implements OauthApi {

	public void signRequest(ApiRequestBuilder request) {
		if (!isLoggedIn()) {
			throw new IllegalStateException("User not logged in");
		}
		request.sign(getAccessKey(), getAccessSecret());
	}

	public <T> T send(ApiRequestBuilder request) throws Exception {
		if (!isLoggedIn()) {
			throw new IllegalStateException("User not logged in");
		}
		request.sign(getAccessKey(), getAccessSecret());
		return request.send();
	}
}
